package com.gc.cscott.cli;

import com.gc.cscott.domain.Competitor;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;

/**
 *
 * @author root
 */
public class ReportUtils {
    public static int longestName(Collection<Competitor> competitors) {
        if (competitors.isEmpty() == true) {
            return 0;
        } else {
            return Collections.max(competitors, new Comparator<Competitor>() {
                public int compare(Competitor left, Competitor right) {
                    return left.getName().length() - right.getName().length();
                }
            }).getName().length();
        }
    }
}
